package io.shuttle.mbe.api

import io.shuttle.mbe.api.annotation.PromiseStyleMinVersion
import io.shuttle.mbe.api.types.Value1Function
import io.shuttle.mbe.api.types.VoidFunction
import io.shuttle.mbe.core.Promise

////////////////////
// Font Settings
////////////////////
/**
 * Use the `Browser.fontSettings` API to manage Chrome's font settings.
 *
 * Permissions: "fontSettings"
 */
interface FontSettings {
    // Clears the default fixed font size set by this extension, if any.
    @PromiseStyleMinVersion(96)
     fun clearDefaultFixedFontSize(
        // This parameter is currently unused.
        details: Any?,
        callback: VoidFunction? = null
    ): Promise<Void>

    // Clears the default font size set by this extension, if any.
    @PromiseStyleMinVersion(96)
     fun clearDefaultFontSize(
        // This parameter is currently unused.
        details: Any?,
        callback: VoidFunction? = null
    ): Promise<Void>

    // Clears the font set by this extension, if any.
    @PromiseStyleMinVersion(96)
     fun clearFont(
        details: FontDetails?,
        callback: VoidFunction? = null
    ): Promise<Void>

    // Clears the minimum font size set by this extension, if any.
    @PromiseStyleMinVersion(96)
     fun clearMinimumFontSize(
        details: Any?,
        callback: VoidFunction? = null
    ): Promise<Void>

    // Gets the default size for fixed width fonts.
    @PromiseStyleMinVersion(96)
     fun getDefaultFixedFontSize(
        details: Any?,
        callback: Value1Function<FontSizeDetails>? = null
    ): Promise<FontSizeDetails>

    // Gets the default font size.
    @PromiseStyleMinVersion(96)
     fun getDefaultFontSize(
        details: Any?,
        callback: Value1Function<FontSizeDetails>? = null
    ): Promise<FontSizeDetails>

    // Gets the font for a given script and generic font family.
    @PromiseStyleMinVersion(96)
     fun getFont(
        details: FontDetails?,
        callback: Value1Function<FontSizeDetails2>? = null
    ): Promise<FontSizeDetails2>

    // getFontList
    @PromiseStyleMinVersion(96)
     fun getFontList(
        callback: Value1Function<List<FontName>>? = null
    ): Promise<List<FontName>>

    // Gets the minimum font size.
    @PromiseStyleMinVersion(96)
     fun getMinimumFontSize(
        details: Any?,
        callback: Value1Function<FontSizeDetails>? = null
    ): Promise<FontSizeDetails>

    // Sets the default size for fixed width fonts.
    @PromiseStyleMinVersion(96)
     fun setDefaultFixedFontSize(
        details: Any?,
        callback: VoidFunction? = null
    ): Promise<Void>

    // Sets the default font size.
    @PromiseStyleMinVersion(96)
     fun setDefaultFontSize(
        details: FontSizeDetails3?,
        callback: VoidFunction? = null
    ): Promise<Void>

    // Sets the font for a given script and generic font family.
    @PromiseStyleMinVersion(96)
     fun setFont(
        details: FontDetails?,
        callback: VoidFunction? = null
    ): Promise<Void>

    // Sets the minimum font size.
    @PromiseStyleMinVersion(96)
     fun setMinimumFontSize(
        details: FontSizeDetails3?,
        callback: VoidFunction? = null
    ): Promise<Void>

    // Fired when the default fixed font size setting changes.
     val onDefaultFixedFontSizeChanged: Events.Event<Value1Function<FontSizeDetails>>

    // Fired when the default font size setting changes.
     val onDefaultFontSizeChanged: Events.Event<Value1Function<FontSizeDetails>>

    // Fired when a font setting changes.
     val onFontChanged: Events.Event<Value1Function<FontDetails>>

     val onMinimumFontSizeChanged: Events.Event<Value1Function<FontSizeDetails>>

    data class FontDetails(
        // The generic font family for which the font should be cleared.
        var genericFamily: GenericFamily,
        // The script for which the font should be cleared. If omitted, the global script font setting is cleared.
        var script: ScriptCode?,
        // The font ID. The empty string means to fallback to the global script font setting.
        var fontId: String,
        // The level of control this extension has over the setting.
        var levelOfControl: LevelOfControl,
    )

    data class FontSizeDetails(
        // The level of control this extension has over the setting.
        var levelOfControl: LevelOfControl,
        // The font size in pixels.
        var pixelSize: Number,
    )

    data class FontSizeDetails3(
        var pixelSize: Number,
    )


    data class FontSizeDetails2(
        // The level of control this extension has over the setting.
        var levelOfControl: LevelOfControl,
        // The font ID. Rather than the literal font ID preference value,
        // this may be the ID of the font that the system resolves the preference value to.
        // So, fontId can differ from the font passed to setFont, if,
        // for example, the font is not available on the system.
        // The empty string signifies fallback to the global script font setting.
        var fontId: String,
    )


    data class FontName(
        // The display name of the font.
        var displayName: String,
        //  The font ID.
        var fontId: String,
    )

    // A CSS generic font family.
    enum class GenericFamily {
        standard,
        sansserif,
        serif,
        fixed,
        cursive,
        fantasy,
        math,
    }

    // One of not\_controllable: cannot be controlled by any extension controlled\_by\_other\_extensions: controlled by extensions with higher precedence controllable\_by\_this\_extension: can be controlled by this extension controlled\_by\_this\_extension: controlled by this extension
    enum class LevelOfControl {
        not_controllable,
        controlled_by_other_extensions,
        controllable_by_this_extension,
        controlled_by_this_extension,
    }

    // An ISO 15924 script code. The default, or global, script is represented by script code "Zyyy".
    enum class ScriptCode {
        Afak, Arab, Armi, Armn, Avst, Bali, Bamu, Bass, Batk, Beng, Blis, Bopo, Brah, Brai, Bugi, Buhd, Cakm, Cans, Cari, Cham, Cher, Cirt, Copt, Cprt, Cyrl, Cyrs, Deva, Dsrt, Dupl, Egyd, Egyh, Egyp, Elba, Ethi, Geor, Geok, Glag, Goth, Gran, Grek, Gujr, Guru, Hang, Hani, Hano, Hans, Hant, Hebr, Hluw, Hmng, Hung, Inds, Ital, Java, Jpan, Jurc, Kali, Khar, Khmr, Khoj, Knda, Kpel, Kthi, Lana, Laoo, Latf, Latg, Latn, Lepc, Limb, Lina, Linb, Lisu, Loma, Lyci, Lydi, Mand, Mani, Maya, Mend, Merc, Mero, Mlym, Moon, Mong, Mroo, Mtei, Mymr, Narb, Nbat, Nkgb, Nkoo, Nshu, Ogam, Olck, Orkh, Orya, Osma, Palm, Perm, Phag, Phli, Phlp, Phlv, Phnx, Plrd, Prti, Rjng, Roro, Runr, Samr, Sara, Sarb, Saur, Sgnw, Shaw, Shrd, Sind, Sinh, Sora, Sund, Sylo, Syrc, Syre, Syrj, Syrn, Tagb, Takr, Tale, Talu, Taml, Tang, Tavt, Telu, Teng, Tfng, Tglg, Thaa, Thai, Tibt, Tirh, Ugar, Vaii, Visp, Wara, Wole, Xpeo, Xsux, Yiii, Zmth, Zsym, Zyyy
    }
}